<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>学生信息页面</title>
<link rel="stylesheet" href="layui/css/layui.css" media="all">

<style>
.layui-btn:not(.layui-btn-lg ):not(.layui-btn-sm):not(.layui-btn-xs) {
	height: 34px;
	line-height: 34px;
	padding: 0 8px;
}
</style>
</head>
<body>
	<div class="layuimini-container">
	<div class="layuimini-main">
		<div class="layui-form" style="margin-top: 20px;" onsubmit="false"> <!--  layui-form-pane -->
			<div class="layui-form-item">
				<label class="layui-form-label">学生姓名:</label>
				<div class="layui-input-inline" style="width: 120;">
					<input type="text" name="stuname" id="stuname" placeholder="请输入学生姓名" class="layui-input">
				</div>
				<label class="layui-form-label">所属咨询师:</label>
				<div class="layui-input-inline" style="width: 120;">
					<select name="suoshuzixunshi" id="suoshuzixunshi" lay-search>
											<option value=""></option>
										</select>
				</div>
				<label class="layui-form-label">学生状态:</label>
				<div class="layui-input-inline" style="width: 120;">
					<select name="stustate" id="stustate" class="layui-input">
						<option value="">请选择状态</option>
						<option value="1">上线</option>
						<option value="2">下线</option>
					</select>
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">电话号码:</label>
				<div class="layui-input-inline" style="width: 120;">
					<input type="text" name="stuphone" id="stuphone" placeholder="请输入电话号码" class="layui-input">
				</div>
				
				<label class="layui-form-label">是否缴费:</label>
				<div class="layui-input-inline" style="width: 120;">
					<select name="Ispay" id="Ispay" class="layui-input">
						<option value="">请选择是否缴费</option>
						<option value="1">已缴费</option>
						<option value="2">未缴费</option>
					</select>
				</div>
                <label class="layui-form-label">是否有效:</label>
				<div class="layui-input-inline" style="width: 120;">
					<select name="isValid" id="isValid" class="layui-input">
						<option value="">请选择是否有效</option>
						<option value="1">有效</option>
						<option value="2">无效</option>
					</select>
				</div>
			</div>
			
			<div class="layui-form-item">
			<label class="layui-form-label">回访情况:</label>
				<div class="layui-input-inline" style="width: 120;">
					<select name="IsReturnVisit" id="IsReturnVisit" class="layui-input">
						<option value="">请回访情况</option>
						<option value="1">已回访</option>
						<option value="2">未回访</option>
					</select>
				</div>
				<label class="layui-form-label">QQ号:</label>
				<div class="layui-input-inline" style="width: 120;">
					<input type="text" name="QQ" id="QQ" placeholder="请输入QQ号" class="layui-input">
				</div>
			</div>
			
			<div class="layui-form-item">
					<div class="layui-inline" id="stucreatetime">
				<label class="layui-form-label">创建时间</label>
					<div class="layui-input-inline" style="width: 150px;">
					    <input type="text" name="beginstucreatetime" id="beginstucreatetime" placeholder="创建起始时间" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-form-mid">-</div>
					<div class="layui-input-inline" style="width: 150px;">
						<input type="text" name="endstucreatetime" id="endstucreatetime" placeholder="创建结束时间" autocomplete="off" class="layui-input">
					</div>
			</div>
			<div class="layui-inline" id="HomeTime">
				<label class="layui-form-label">上门时间</label>
					<div class="layui-input-inline" style="width: 150px;">
					    <input type="text" name="beginHomeTime" id="beginHomeTime" placeholder="上门起始时间" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-form-mid">-</div>
					<div class="layui-input-inline" style="width: 150px;">
						<input type="text" name="endHomeTime" id="endHomeTime" placeholder="上门结束时间" autocomplete="off" class="layui-input">
					</div>
			</div>
				<button class="layui-btn" id="search" data-type="reload" type="button">搜索</button>
			</div>
			
		</div>
	</div>
	<div>
		<table class="layui-hide" id="test" lay-filter="test"></table>
	</div>
</div>




	<!-- 操作列 -->
	<script type="text/html" id="barDemo">
            
			<a class="layui-btn layui-btn-normal layui-btn-xs data-count-tarck" lay-event="tarck">跟踪日志</a>
			<a class="layui-btn layui-btn-normal layui-btn-xs data-count-createTarck" lay-event="createTarck">创建跟踪</a>
			<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="editStudents">信息完善</a>
			<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delStudents">删除</a>
		</script>
	<script type="text/html" id="toolbarDemo">
      <!--表头上面引入了一个添加学生的操作-->
      <div class="layui-btn-container">
      <!--  <button class="layui-btn layui-btn-sm" lay-event="addStudents">信息录入</button>-->
<button class="layui-btn layui-btn-normal layui-btn-sm data-excel-btn" lay-event="excel"> 信息导出表格 </button>
      </div>
    </script>
	<script src="layui/layui.js" charset="utf-8"></script>
	<script src="js/Global.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/lay-module/excel/excel.js" type="text/javascript"></script>
		 <script type="text/html" id="switchTpl">
      {{#  if(d.stugender == 1){ }}
          <span style="color: #F581B1;">男</span>
      {{#  } else if(d.stugender == 2){ }}
          <span style="color: #1e9fff;">女</span>
      {{#  } }}
         </script>
          <script type="text/html" id="stustate_pl">
      {{#  if(d.stustate == 1){ }}
          <span style="color: #F581B1;">上线</span>
      {{#  } else if(d.stustate == 2){ }}
          <span style="color: #1e9fff;">下线</span>
      {{#  } }}
         </script>
          <script type="text/html" id="IsReportbaobei">
      {{#  if(d.isReport == 1){ }}
          <span style="color: #F581B1;">已报备</span>
      {{#  } else if(d.isReport == 2){ }}
          <span style="color: #1e9fff;">未报备</span>
      {{#  } }}
         </script>
         
          <script type="text/html" id="IsValidyouxiao">
      {{#  if(d.isValid == 1){ }}
          <span style="color: #F581B1;">有效</span>
      {{#  } else if(d.isValid == 2){ }}
          <span style="color: #1e9fff;">无效</span>
      {{#  } }}
         </script>
         
          <script type="text/html" id="IsReturnVisithuifang">
      {{#  if(d.isReturnVisit == 1){ }}
          <span style="color: #F581B1;">已回访</span>
      {{#  } else if(d.isReturnVisit == 2){ }}
          <span style="color: #1e9fff;">未回访</span>
      {{#  } }}
         </script>
         
          <script type="text/html" id="IsHomeshangmen">
      {{#  if(d.isHome == 1){ }}
          <span style="color: #F581B1;">已上门</span>
      {{#  } else if(d.isHome == 2){ }}
          <span style="color: #1e9fff;">未上门</span>
      {{#  } }}
         </script>
	
	 <script type="text/html" id="IsReturnMoneytuifei">
      {{#  if(d.isReturnMoney == 1){ }}
          <span style="color: #F581B1;">已退费</span>
      {{#  } else if(d.isReturnMoney == 2){ }}
          <span style="color: #1e9fff;">未退费</span>
      {{#  } }}
         </script>
         
          <script type="text/html" id="IsInClassjinban">
      {{#  if(d.isInClass == 1){ }}
          <span style="color: #F581B1;">已进班</span>
      {{#  } else if(d.isInClass == 2){ }}
          <span style="color: #1e9fff;">未进班</span>
      {{#  } }}
         </script>
         
         <script type="text/html" id="Ispayjiaofei">
      {{#  if(d.ispay == 1){ }}
          <span style="color: #F581B1;">已缴费</span>
      {{#  } else if(d.ispay == 2){ }}
          <span style="color: #1e9fff;">未缴费</span>
      {{#  } }}
         </script>
	<script>
		layui.use([ 'form', 'table' ],  function() { //如果只加载一个模块，可以不填数组。如：layui.use('form')
			var table = layui.table; //获取table模块
			var form = layui.form;
			var $ = layui.jquery;
			// 渲染表格
			table.render({
				elem : '#test',
				url : globalData.server+'public/getByUserid',
				toolbar : '#toolbarDemo', //开启头部工具栏
				where : {
					method : 'getAll',
					'userid': globalData.getUid(),
					stuname : '',
					username:'',
					stustate : '',
					stuphone:'',
					Ispay : '',
					isValid:'',
					IsReturnVisit : '',
					QQ:'',
					beginstucreatetime : '',
					endstucreatetime:'',
					beginHomeTime : '',
					endHomeTime:''
				},
				method : 'POST',
				cols : [ [ {
					type: 'checkbox',
					fixed: 'left'
				},{
					field : 'stuid',
					title : '学生ID',
					fixed : 'left',
					align:'center',
					sort : true,
					width : 120,
				}, {
					field : 'stuname',
					title : '学生姓名',
					align:'center',
					width : 90,
				}, {
					field : 'stuage',
					title : '学生年龄',
					align:'center',
					width : 110,
				}, {
					field : 'stugender',
					title : '学生性别',
				 	templet: '#switchTpl', 
					align:'center',
					width : 110,
				}, {
					field : 'lururen',
					title : '录入人',
					align:'center',
					width : 120,
				}, {
					field : 'suoshuzixunshi',
					title : '所属咨询师',
					align:'center',
					width : 120,
				}, {
					field : 'stuphone',
					title : '学生电话号码',
					align:'center',
					width : 180,
				}, {
					field : 'stuacademic',
					title : '学历',
					align:'center',
					width : 180,
				}, {
					field : 'stustate',
					title : '学生状态',
					templet : '#stustate_pl',
					align:'center',
					width : 125,
				},{
					field : 'stucreatetime',
					title : '创建时间',
					templet : "<div>{{layui.util.toDateString(d.stucreatetime, 'yyyy-MM-dd HH:mm:ss')}}</div>", 
					align:'center',
					width : 180,
				}, {
					field : 'sources',
					title : '来源渠道',
					align:'center',
					width : 180,
				}, {
					field : 'sourceurl',
					title : '来源网址',
					align:'center',
					width : 180,
				}, {
					field : 'sourcekeyword',
					title : '来源关键词',
					align:'center',
					width : 120,
				}, {
					field : 'weChat',
					title : '微信号',
					align:'center',
					width : 120,
				}, {
					field : 'qq',
					title : 'QQ号',
					align:'center',
					width : 120,
				}, {
					field : 'stusourcedep',
					title : '来源部门',
					align:'center',
					width : 120,
				}, {
					field : 'isReport',
					title : '是否报备',
					templet : '#IsReportbaobei',
					align:'center',
					width : 120,
				}, {
					field : 'learnforward',
					title : '课程方向',
					align:'center',
					width : 120,
				}, {
					field : 'isValid',
					title : '是否有效',
					templet : '#IsValidyouxiao',
					align:'center',
					width : 120,
				}, {
					field : 'mark',
					title : '打分',
					align:'center',
					width : 120,
				}, {
					field : 'isReturnVisit',
					title : '是否回访',
					templet : '#IsReturnVisithuifang',
					align:'center',
					width : 120,
				}, {
					field : 'firstVisitTime',
					title : '首次回访时间',
					templet : "<div>{{layui.util.toDateString(d.firstVisitTime, 'yyyy-MM-dd HH:mm:ss')}}</div>", 
					align:'center',
					width : 180,
				}, {
					field : 'isHome',
					title : '是否上门',
					templet : '#IsHomeshangmen',
					align:'center',
					width : 120,
				}, {
					field : 'homeTime',
					title : '上门时间',
					templet : "<div>{{layui.util.toDateString(d.homeTime, 'yyyy-MM-dd HH:mm:ss')}}</div>", 
					align:'center',
					width : 180,
				}, {
					field : 'invalidReason',
					title : '无效原因',
					align:'center',
					width : 120,
				}, {
					field : 'Ispay',
					title : '是否缴费',
					templet : '#Ispayjiaofei',
					align:'center',
					width : 120,
				}, {
					field : 'payTime',
					title : '缴费时间',
					templet : "<div>{{layui.util.toDateString(d.payTime, 'yyyy-MM-dd HH:mm:ss')}}</div>", 
					align:'center',
					width : 180,
				}, {
					field : 'money',
					title : '金额',
					align:'center',
					width : 120,
				}, {
					field : 'isReturnMoney',
					title : '是否退费',
					templet : '#IsReturnMoneytuifei',
					align:'center',
					width : 120,
				}, {
					field : 'isInClass',
					title : '是否进班',
					templet : '#IsInClassjinban',
					align:'center',
					width : 120,
				}, {
					field : 'inClassTime',
					title : '进班时间',
					templet : "<div>{{layui.util.toDateString(d.inClassTime, 'yyyy-MM-dd HH:mm:ss')}}</div>", 
					align:'center',
					width : 180,
				}, {
					field : 'inClassContent',
					title : '进班备注',
					align:'center',
					width : 120,
				}, {
					field : 'refundReason',
					title : '退费原因',
					align:'center',
					width : 120,
				}, {
					field : 'depositMoney',
					title : '定金金额',
					align:'center',
					width : 120,
				}, {
					field : 'depositTime',
					title : '定金时间',
					templet : "<div>{{layui.util.toDateString(d.depositTime, 'yyyy-MM-dd HH:mm:ss')}}</div>", 
					align:'center',
					width : 180,
				}, {
					title : '操作',
					fixed : 'right',
					align : 'center',
					toolbar : '#barDemo',
					width : 330
				} ] ],
				id : 'testReload',
				page : true/* ,
				skin: 'line' */
			});
			
			
			
		
			
			
			
			$('#search').on('click', function() {
				var stuname = $("#stuname").val();
				var username = $("#username").val();
				var stustate = $("#stustate").val();
				var stuphone = $("#stuphone").val();
				var Ispay = $("#Ispay").val();
				var isValid = $("#isValid").val();
				var IsReturnVisit = $("#IsReturnVisit").val();
				var QQ = $("#QQ").val();
				var beginstucreatetime = $("#beginstucreatetime").val();
				var endstucreatetime = $("#endstucreatetime").val();
				var beginHomeTime = $("#beginHomeTime").val();
				var endHomeTime = $("#endHomeTime").val();
				/* var userid = $("#userid").val(); */
				//执行搜索重载
				table.reload('testReload', {
					where : {
						/* if判断 */'userid': globalData.getUid(),
						'stuname' : stuname,
						'username':username,
						'stustate':stustate,
						'stuphone':stuphone,
						'Ispay':Ispay,
						'IsValid':isValid,
						'IsReturnVisit':IsReturnVisit,
						'QQ':QQ,
						'beginstucreatetime':beginstucreatetime,
						'endstucreatetime':endstucreatetime,
						'beginHomeTime':beginHomeTime,
						'endHomeTime':endHomeTime
					}
				});
			});
			
			/*咨询师动态下拉框*/
			$.get(globalData.server + "public/getSignConsultant", {
				'page': 1,
				'limit': 9999
			}, function(obj) {
				console.log(obj);
				if(obj.count > 0) {
					for(var i = 0; i < obj.data.length; i++) {
						$("#suoshuzixunshi").append(new Option(obj.data[i].username,obj.data[i].userid));
					}
				}
				form.render("select");
			}, "json");
			var onelist=[];
			var twolist=[];
			var type=null;
			//监听表格复选框选择
			table.on('checkbox(test)', function(obj) {
				console.log(obj);
				console.log(obj.data.stuid);
				console.log(obj.type);
				if (obj.type=='one') {
					type=1;
					if (obj.checked==true) {
						onelist.push(parseInt(obj.data.stuid));
					}else{
						twolist.push(parseInt(obj.data.stuid));
					}
					console.log(onelist);
				} else if (obj.type=='all'){
					type=2;
				}
			});
			
			//监听提交按钮
			table.on('tool(test)', function(obj) {
				var data = obj.data;
				if (obj.event === 'delStudents') {
					layer.confirm('真的删除该学生信息吗?', function(index) {
						console.log(obj.data);
						var url = globalData.server+'public/deleteStudents2';
						$.post(url, {
							"stuid" : obj.data.stuid,
							method : 'delete'
						}, function(res) {
							if(res.count > 0) {
								layer.msg("删除成功", {
									icon: 1,
									time: 3000
								});
								obj.del();
							} else if(res.count == -1) {
								layer.msg("删除失败", {
									icon: 2,
									time: 3000
								})
							}
						}, "json");
						layer.close(index);
					});
				} else if (obj.event === 'editStudents') {
					console.log(obj.data);
					layer.open({ //打开一个页面
						type : 2, //在当前的页面之上，弹框形式，展示出添加学生的界面
						area : [ '1100px', '450px' ], //页面的宽高
						content : 'Students_edit.html', //页面所在的位置
						title : '编辑学生信息',
						fix:false,
						maxmin:true,
						success : function(layero, index) {
							console.log(obj.data);
							var body = layer.getChildFrame('body', index);
							layui.form.render();
							var iframe = layero.find('iframe')[0].contentWindow;
							
							body.contents().find("#stuid").val(obj.data.stuid);/* title */
							body.contents().find("#stuname").val(obj.data.stuname);
							body.contents().find("#stuage").val(obj.data.stuage);
							body.contents().find("#stugender2").val(obj.data.stugender);
							body.contents().find("#stuphone").val(obj.data.stuphone);
							body.contents().find("#stuacademic").val(obj.data.stuacademic);
							body.contents().find("#stustate2").val(obj.data.stustate);
							body.contents().find("#stucreatetime").val(layui.util.toDateString(obj.data.stucreatetime, 'yyyy-MM-dd HH:mm:ss'));
							body.contents().find("#sources").val(obj.data.sources);
							body.contents().find("#sourceurl").val(obj.data.sourceurl);
							body.contents().find("#sourcekeyword").val(obj.data.sourcekeyword);
							body.contents().find("#lururen").val(obj.data.lururen);
							body.contents().find("#suoshuzixunshi").val(obj.data.suoshuzixunshi);
							body.contents().find("#WeChat").val(obj.data.weChat);
							body.contents().find("#QQ").val(obj.data.qq);
							body.contents().find("#stusourcedep").val(obj.data.stusourcedep);
							body.contents().find("#IsReport").val(obj.data.isReport);
							body.contents().find("#learnforward").val(obj.data.learnforward);
							body.contents().find("#IsValid").val(obj.data.isValid);
							body.contents().find("#mark").val(obj.data.mark);
							body.contents().find("#IsReturnVisit").val(obj.data.isReturnVisit);
							body.contents().find("#FirstVisitTime").val(layui.util.toDateString(obj.data.FirstVisitTime, 'yyyy-MM-dd HH:mm:ss'));
							body.contents().find("#IsHome").val(obj.data.isHome);
							body.contents().find("#HomeTime").val(layui.util.toDateString(obj.data.HomeTime, 'yyyy-MM-dd HH:mm:ss'));
							body.contents().find("#InvalidReason").val(obj.data.invalidReason);
							body.contents().find("#Ispay").val(obj.data.ispay);
							body.contents().find("#PayTime").val(layui.util.toDateString(obj.data.PayTime, 'yyyy-MM-dd HH:mm:ss'));
							body.contents().find("#Money").val(obj.data.money);
							body.contents().find("#IsReturnMoney").val(obj.data.isReturnMoney);
							body.contents().find("#IsInClass").val(obj.data.isInClass);
							body.contents().find("#InClassTime").val(layui.util.toDateString(obj.data.InClassTime, 'yyyy-MM-dd HH:mm:ss'));
							body.contents().find("#InClassContent").val(obj.data.inClassContent);
							body.contents().find("#RefundReason").val(obj.data.refundReason);
							body.contents().find("#DepositMoney").val(obj.data.depositMoney);
							body.contents().find("#DepositTime").val(layui.util.toDateString(obj.data.DepositTime, 'yyyy-MM-dd HH:mm:ss'));
							iframe.layui.form.render('select');
						},
						end : function() {
							window.location.reload();
						}
					});
				}else if(obj.event === 'tarck') {
					var index = layer.open({
						title: '查询 ' + data.stuname+" 同学的跟踪信息",
						type: 2,
						shade: 0.2,
						maxmin: true,
						shadeClose: true,
						area: ['100%', '100%'],
						content: 'TrackStudents.html',
						success : function(layero, index) {
							console.log(obj.data);
							var body = layer.getChildFrame('body', index);
							body.find("#stuid").val(obj.data.stuid);
						},
						end: function() {
							window.location.reload();
						}
					});
					$(window).on("resize", function() {
						layer.full(index);
					});
				} else if(obj.event === 'createTarck') {
					var index = layer.open({
						title: '添加 ' + data.stuname + ' 的跟踪信息',
						type: 2,
						shade: 0.2,
						maxmin: true,
						shadeClose: true,
						area: ['100%', '100%'],
						content: 'TrackStudents_add.html',
						success: function(layero, index) {
							var body = layer.getChildFrame('body', index);
							body.find("#stuid").val(data.stuid);
						},
						end: function() {
							window.location.reload();
						}
					});
					$(window).on("resize", function() {
						layer.full(index);
					});
				}
				
				
				
				
			});
			
			
			//监听行单击事件（双击事件为：rowDouble）
			table.on('rowDouble(test)', function(obj) {
				var data = obj.data;
				var index = layer.open({
						title:  data.stuname+" 学生详情页面",
						type: 2,
						shade: 0.2,
						maxmin: true,
						shadeClose: true,
						area : [ '1100px', '450px' ], //页面的宽高
						content: 'Students_detail.html',
						success: function(layero, index) {
							console.log(obj.data);
							var body = layer.getChildFrame('body', index);
							layui.form.render();
							var iframe = layero.find('iframe')[0].contentWindow;
							
							body.contents().find("#stuid").val(obj.data.stuid);/* title */
							body.contents().find("#stuname").val(obj.data.stuname);
							body.contents().find("#stuage").val(obj.data.stuage);
							body.contents().find("#stugender").val(obj.data.stugender);
							body.contents().find("#stuphone").val(obj.data.stuphone);
							body.contents().find("#stuacademic").val(obj.data.stuacademic);
							body.contents().find("#stustate").val(obj.data.stustate);
							body.contents().find("#stucreatetime").val(layui.util.toDateString(obj.data.stucreatetime, 'yyyy-MM-dd HH:mm:ss'));
							body.contents().find("#sources").val(obj.data.sources);
							body.contents().find("#sourceurl").val(obj.data.sourceurl);
							body.contents().find("#sourcekeyword").val(obj.data.sourcekeyword);
							body.contents().find("#clerkid").val(obj.data.lururen);
							body.contents().find("#userid").val(obj.data.suoshuzixunshi);
							body.contents().find("#WeChat").val(obj.data.weChat);
							body.contents().find("#QQ").val(obj.data.qq);
							body.contents().find("#stusourcedep").val(obj.data.stusourcedep);
							body.contents().find("#IsReport").val(obj.data.isReport);
							body.contents().find("#learnforward").val(obj.data.learnforward);
							body.contents().find("#IsValid").val(obj.data.isValid);
							body.contents().find("#mark").val(obj.data.mark);
							body.contents().find("#IsReturnVisit").val(obj.data.isReturnVisit);
							body.contents().find("#FirstVisitTime").val(layui.util.toDateString(obj.data.FirstVisitTime, 'yyyy-MM-dd HH:mm:ss'));
							body.contents().find("#IsHome").val(obj.data.isHome);
							body.contents().find("#HomeTime").val(layui.util.toDateString(obj.data.HomeTime, 'yyyy-MM-dd HH:mm:ss'));
							body.contents().find("#InvalidReason").val(obj.data.invalidReason);
							body.contents().find("#Ispay").val(obj.data.ispay);
							body.contents().find("#PayTime").val(layui.util.toDateString(obj.data.PayTime, 'yyyy-MM-dd HH:mm:ss'));
							body.contents().find("#Money").val(obj.data.money);
							body.contents().find("#IsReturnMoney").val(obj.data.isReturnMoney);
							body.contents().find("#IsInClass").val(obj.data.isInClass);
							body.contents().find("#InClassTime").val(layui.util.toDateString(obj.data.InClassTime, 'yyyy-MM-dd HH:mm:ss'));
							body.contents().find("#InClassContent").val(obj.data.inClassContent);
							body.contents().find("#RefundReason").val(obj.data.refundReason);
							body.contents().find("#DepositMoney").val(obj.data.depositMoney);
							body.contents().find("#DepositTime").val(layui.util.toDateString(obj.data.DepositTime, 'yyyy-MM-dd HH:mm:ss'));
							iframe.layui.form.render('select');
						},
						end: function() {
						}
					});

				//标注选中样式
				obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
			});
			
			
			
			
			
			table.on('toolbar(test)', function(obj) {
				if (obj.event==='addStudents') { // 监听添加操作
					
					var index=	layer.open({
							type : 2,
							area : [ '1100px', '500px' ], //页面的宽高
							content : 'students_add.html',
							title : '添加学生信息',
							fix:false,
							maxmin:true,
							end : function() {
								window.location.reload();
							}
						});
					$(window).on("resize", function() {
						layer.full(index);
					});
					}else if (obj.event==='excel') {
					//询问框
					layer.confirm('确定导出表格吗？', {
					  btn: ['确定','取消'] //按钮
					}, function(){
						$.post(globalData.server+"public/excel",{
							"type":type,
							"one":onelist,
							"two":twolist
						},function(res){
							if (res.count>0) {
								 // 假如返回的 res.data 是需要导出的列表数据
				            console.log(res.data);// [{name: 'wang', age: 18, sex: '男'}, {name: 'layui', age: 3, sex: '女'}]
				            // 1. 数组头部新增表头
				            res.data.unshift({stuid: '学生ID',
				            	stuname: '学生姓名',
				            	stuage: '学生年龄',
				            	stugender: '学生性别',
				            	stuphone :'学生电话号码',
				            	stuacademic:'学历',
				            	stustate:'学生状态',
				            	stucreatetime:'创建时间',
				            	sources:'来源渠道',
				            	sourceurl:'来源网址',
				            	sourcekeyword:'来源关键词',
				            	lururen:'录入人',
				            	suoshuzixunshi:'所属咨询师',
				            	weChat:'微信号',
				            	qq:'QQ号',
				            	stusourcedep:'来源部门',
				            	isReport:'是否报备',
				            	learnforward:'课程方向',
				            	isValid:'是否有效',
				            	mark:'打分',
				            	isReturnVisit:'是否回访',
				            	firstVisitTime:'首次回访时间',
				            	isHome:'是否上门',
				            	homeTime:'上门时间',
				            	invalidReason:'无效原因',
				            	ispay:'是否缴费',
				            	payTime:'缴费时间',
				            	money:'金额',
				            	isReturnMoney:'是否退费',
				            	isInClass:'是否进班',
				            	inClassTime:'进班时间',
				            	inClassContent:'进班备注',
				            	refundReason:'退费原因',
				            	depositMoney:'定金金额',
				            	depositTime:'定金时间' });
				            // 2. 如果需要调整顺序，请执行梳理函数
				            var data = LAY_EXCEL.filterExportData(res.data, [
				                'stuid','stuname','stuage','stugender',
				                'stuphone','stuacademic','stustate','stucreatetime',
				                'sources','sourceurl','sourcekeyword','lururen',
				                'suoshuzixunshi','weChat','qq','stusourcedep',
				                'isReport','learnforward','isValid','mark','isReturnVisit',
				                'firstVisitTime','isHome','homeTime','invalidReason','ispay',
				                'payTime','money','isReturnMoney','isInClass','inClassTime',
				                'inClassContent','refundReason','depositMoney','depositTime'
				            ]);
				            // 3. 执行导出函数，系统会弹出弹框
				            LAY_EXCEL.exportExcel({
				                sheet1: data
				            }, '我的学生信息'+ layui.util.toDateString(new Date(), 'yyyy年MM月dd日 HH:mm:ss') + '.xlsx', 'xlsx');
							}
						},"json");
					}, function(){
						
					});
				};
			});
		});
		layui.use('laydate', function() {
			var laydate = layui.laydate;
			//同时绑定多个时间选择器
			laydate.render({
				elem : '#beginstucreatetime',
				type : 'datetime'
			});
			laydate.render({
				elem : '#endstucreatetime',
				type : 'datetime'
			});
			laydate.render({
				elem : '#beginHomeTime',
				type : 'datetime'
			});
			laydate.render({
				elem : '#endHomeTime',
				type : 'datetime'
			});
		});
	</script>
	<script type="text/html" id="switchTpl">
  <input type="checkbox" name="IsLockout" value="{{d.userid}}" lay-skin="switch"
 lay-text="启用|禁用" lay-filter="u_stateDemo" {{ d.IsLockout == 1 ? 'checked' : '' }}>
</script>
</body>
</html>